<form class="layui-form" method="post">
    <div class="layui-form-item" style="padding-top: 2%">
        <label class="layui-form-label">任务站点：</label>
        <div class="layui-input-inline">
            <select name="site">
                <option value="">站点列表</option>
                <volist name="sitedao" id="site">
                    <option value="{$site.site_id}">{$site.site_name}</option>
                </volist>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">任务类型：</label>
        <div class="layui-input-inline">
            <select name="pinicBuying-types">
                <option value="1">抽签抢购</option>
                <option value="2">立即抢购</option>
            </select>

        </div>
    </div>
 <!--   <div class="layui-form-item">
        <label class="layui-form-label">线程数量：</label>
        <div class="layui-input-inline">
            <input type="text" name="sernumber" lay-verify="required" maxlength="2" placeholder="1"value="1" autocomplete="off" class="layui-input">
        </div>
    </div>-->
    <div class="layui-form-item">
        <label class="layui-form-label">商品链接：</label>
        <div class="layui-input-block">
            <input type="text" name="pro-url" lay-verify="required|url" placeholder="抢购商品链接" autocomplete="off" class="layui-input layui-input80">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">抢购时间：</label>
        <div class="layui-input-block">
            <input type="text" name="product-time" lay-verify="required" autocomplete="off" placeholder="抢购时间"  onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" class="layui-input layui-input80">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="sitesub">提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>
        form.render();
        form.on('submit(sitesub)', function(data){
            var index=layer.load(1, {shade: [0.8, '#393D49'],time: 100000,area: ['100px','100px']});
            var userInfo = data.field;
            var url = "__SELF__";
            $.ajax({
                url :url,
                type : 'post',
                async: false,
                data : userInfo,
                success : function(data){
                    layer.close(index);
                    if(data.code == '4001'){
                        layer.msg(data.msg,{icon: 5});
                        return;
                    }else if(data.code == '101'){
                        layer.closeAll()
                        layer.msg(data.msg, {
                            icon: 6,
                            time: 2000
                        }, function(){

                            location.reload();
                           /* var url = "{:U('Task/addTask')}";
                             $.get(url,function(data){
                             if(data.code == '4001'){
                             layer.msg(data.msg,{icon: 5});
                             return;
                             }
                             layer.open({
                             title:'添加站点任务',
                             type: 1,
                             skin: 'layui-layer-rim',
                             area: ['800px','500px'],
                             content: data
                             });
                             });*/
                        });
                    }else{

                        layer.msg("数据错误",{icon: 5});
                        return;
                    }
                }
            });
            return false;
        });

</script>